package com.xy.order.controller;

import com.ruoyi.common.core.domain.order.vo.TakeOrdersInfo;
import com.ruoyi.common.core.domain.user.Address;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.xy.order.service.dto.TakeOrdersService01;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/order2")
public class TakeOrdersService01Controller extends BaseController {
    @Autowired
    private TakeOrdersService01 takeOrdersService01;

    /**
     * 1. 选择服务类型
     * @return
     */
    @GetMapping("/list")
    public Object list() {
        return takeOrdersService01.listServices();
    }

    /**
     * 2. 选择用户、地址、联系电话
     * @param serviceId
     * @return
     */
    @GetMapping("/selectOrderTypeByServiceId")
    public Object selectOrderTypeByServiceId(@RequestParam("serviceId") Long serviceId) {
        return takeOrdersService01.selectOrderTypeByServiceId(serviceId);
    }

    /**
     * 3. 用户下单
     */
    @PostMapping("/insertOrder")
    public Object insertOrder(@RequestBody TakeOrdersInfo takeOrdersInfo) {
        return takeOrdersService01.addOrder(takeOrdersInfo);
    }


    /**
     * 4. 获取服务技能
     */
    @GetMapping("/selectSkillsByServiceId")
    public Object selectSkillsByServiceId(@RequestParam("serviceId") Long serviceId) {
        return takeOrdersService01.selectSkillsByServiceId(serviceId);
    }
}
